package errorx


var ParamsError = NewBizError(1101,"参数错误")
type BizError struct {
	Code int  `json:"code"`
	Message string  `json:"message"`
}

func NewBizError(code int,message string) *BizError{
	return &BizError{
		Code: code,
		Message: message,
	}
}

func (e *BizError)Error() string {

	return e.Message
}

type ErrorResponse struct{
	Code int  `json:"code"`
	Message string  `json:"message"`
}

func (e *BizError)Data() *ErrorResponse{
	return &ErrorResponse{
		e.Code,
		e.Message,
	}
}